package com.itheima.demo02;

import java.util.List;
import java.util.Map;
import java.util.Set;

//不可变的集合
public class StreamClass02 {
    public static void main(String[] args) {
        //method1();
        //method2();
        //method3();
        method4();
    }

    private static void method4() {
        Map<String,Integer> map = Map.ofEntries(
                Map.entry("张三",23),
                Map.entry("李四",24),
                Map.entry("王五",25));
        System.out.println(map);
    }

    private static void method3() {
        Map<String,Integer> map = Map.of("张三",23,"李四",24,"王五",25);
        System.out.println(map);
    }

    private static void method2() {
        //不能添加相同的元素
        Set<String> set = Set.of("a","b","c"/*,"a"*/);
        System.out.println(set);
    }

    private static void method1() {
        List<String> list = List.of("a","b","c");
        System.out.println(list);
//        list.add("d");
//        list.remove("a");
//        list.set(0,"e");
        System.out.println(list);
    }
}
